Skip to content

feat(ptodsl): expose store atomic configuration - #1039

Draft
mouliangyu wants to merge 3 commits into
hw-native-sys:mainfrom
mouliangyu:codex/store-atomic-structured
Draft

feat(ptodsl): expose store atomic configuration#1039
mouliangyu wants to merge 3 commits into
hw-native-sys:mainfrom
mouliangyu:codex/store-atomic-structured

Conversation

@mouliangyu

@mouliangyu mouliangyu commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

背景

TileLang #115 为了与 AscendC 风格保持一致,会将 UB→GM atomic copy 降为:

pto.set_atomic_s32()
pto.set_atomic_add()
pto.mte_ub_gm(...)
pto.set_atomic_none()

本 PR 将个人仓 #569 的两个提交迁移到主仓,为这组 PTODSL/VPTO 配置接口补齐 lowering。

改动

  • 暴露 set_atomic_add/max/min/noneset_atomic_f32/f16/bf16/s32/s16/s8 PTODSL 接口。
  • 将上述 CCE 风格接口展开为对 CTRL[10:6] 的有序读改写,使 dtype/op 状态作用于后续 MTE/FIXP store。
  • get_ctrl 改为有序读取,避免 CSE 跨越 set_ctrl 复用旧值。
  • 保留 set_store_atomic_cfg(config),并 lowering 到 llvm.hivm.SET.ST.ATOMIC.CFG;该接口属于 SU scalar atomic 路径,不用于 UB→GM MTE atomic。
  • 增加 PTODSL surface test、VPTO wrapper expansion lit test,以及由 ci-sim 自动发现并执行的 UB→GM s32 atomic add runtime case。

验证

  • cmake --build build -j 16
  • focused lit:store_atomic_ctrl_expand.pto(1/1 passed)
  • ctest --test-dir build -R '^ptodsl_jit_compile$' --output-on-failure(1/1 passed)
  • CASE_NAME='micro-op/vector-load-store/mte-ub-gm-atomic-add-s32' test/vpto/scripts/run_host_vpto_validation.sh:A5 CA model compare passed;GM 初值 10、UB 输入 3,64 个输出均为 13
  • git diff --check

CA model 对照也确认 SET.ST.ATOMIC.CFG(4) 不控制 mte_ub_gm,其结果为普通覆盖;UB→GM atomic 使用本 PR 增加的 set_atomic_{dtype/op} CTRL 路径。

peanutchan and others added 2 commits July 29, 2026 12:53
Add the minimal PTODSL and VPTO lowering needed for TileLang UB-to-GM atomic add, max, and min copies.

Co-authored-by: Cursor <cursoragent@cursor.com>
Expose CCE-style atomic configuration operations and preserve ordered CTRL reads so dtype and operation state reaches asynchronous MTE stores.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mouliangyu
mouliangyu force-pushed the codex/store-atomic-structured branch from 475fb5f to 59c7804 Compare July 29, 2026 10:02
@mouliangyu mouliangyu changed the title feat(ptodsl): add scoped UB-to-GM atomic stores feat(ptodsl): expose store atomic configuration Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants